<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
$title="Thêm người dùng";
require '../layout/headeradmin.inc';

if(isset($_POST['them-nguoidung']))
{
    $name=  trim($_POST['name-add']);
    $username=trim( $_POST['username-add']);
    $pass=trim($_POST['password-add']);
    $check_add=0;
    if(isset($_POST['check-add']))
    {
        $check_add=1;
    }
   
     if(get_magic_quotes_gpc())
    {
        $name=  trim(mysqli_real_escape_string($_POST['name-add']));
        $username=trim(mysqli_real_escape_string($_POST['username-add']));
        $password=trim(mysqli_real_escape_string($_POST['password-add']));
    }
//    echo $name.$username.$pass;
    $k->addUser($name,$username,$pass,$check_add);
    error_reporting(E_ALL);
   header("Location:home.php");
}
else
{

?>
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
    <fieldset>
        <legend><text>Thêm người dùng</text></legend>
        <table id="t-adduser">
            <tbody>
                <tr>
                    <td><label>Tên người dùng</label></td>
                    <td><input type="text" id="name-add" name="name-add"></td>
                </tr>
                 <tr>
                    <td><label>Tên đăng nhập</label></td>
                    <td><input type="text" id="username-add" name="username-add"></td>
                </tr>
                <tr>
                    <td><label>Mật khẩu</label></td>
                    <td><input type="password" id="password-add" name="password-add"></td>
                </tr>
                <tr>
                    <td><label>Hoạt động</label></td>
                    <td><input type="checkbox" id="check-add" name="check-add"></td>
                </tr>
                <tr>
                    <td colspan="2" style="text-align: center;" >
                        <div>
                            <input type="submit" name="them-nguoidung" value="Thêm" >
                            <input type="button" name="huy" value="Hủy" >
                        </div>
                    </td>
                </tr>
            </tbody>
            <tfoot>
                
            </tfoot>
        </table>
    </fieldset>
</form>



<?php
}
require '../layout/footeradmin.inc';
?>